home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / CITY.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  937b  |  32 lines

  1. ' CITY.BAS
  2. ' This program stores a list of cities in a sequential file.
  3.  
  4. OPEN "CITY.TXT" FOR OUTPUT AS #1      ' open file in current drive/dir
  5.  
  6. CLS
  7.  
  8. PRINT "This program stores city names on disk in a file named CITY.TXT."
  9. PRINT "Enter your favorite cities and type END to quit."
  10. PRINT
  11.  
  12. DO WHILE (city$ <> "END")             ' until user enters END
  13.     INPUT "  City name:  ", city$     '   get names from user
  14.     IF (city$ <> "END") THEN PRINT #1, city$   ' write names to file
  15. LOOP
  16.  
  17. CLOSE #1                              ' close file
  18.  
  19. PRINT
  20. INPUT "Press Enter to see the cities you entered.  ", dummy$
  21. PRINT
  22.  
  23. OPEN "CITY.TXT" FOR INPUT AS #1       ' open file for input
  24.  
  25. DO WHILE (NOT EOF(1))                 ' until end of file is reached
  26.     INPUT #1, city$                   '   get names
  27.     PRINT city$                       '   print names
  28. LOOP
  29.  
  30. CLOSE #1                              ' close file
  31.  
  32.